package sample.plugin.language.base;

import com.rapid.api.lang.engine.highlight.decision.Decision;
import com.rapid.api.lang.engine.highlight.decision.DecisionResult;

import java.util.Arrays;
import java.util.Collections;

public abstract class AbstractDecision<S> implements Decision<S> {
    public Iterable<DecisionResult> single(DecisionResult result) {
        return Collections.singleton(result);
    }

    public Iterable<DecisionResult> singleColor(int schema) {
        DecisionResult result = new DecisionResult();
        result.kind = DecisionResult.ResultKind.ACCEPT;
        result.content = new DecisionResult.StyleContent(schema);
        return Collections.singleton(result);
    }

    public Iterable<DecisionResult> singleColorBold(int schema) {
        DecisionResult result = new DecisionResult();
        result.kind = DecisionResult.ResultKind.ACCEPT;
        result.content = new DecisionResult.StyleContent(schema, true, false);
        return Collections.singleton(result);
    }

    public Iterable<DecisionResult> singleColorItalic(int schema) {
        DecisionResult result = new DecisionResult();
        result.kind = DecisionResult.ResultKind.ACCEPT;
        result.content = new DecisionResult.StyleContent(schema, false, true);
        return Collections.singleton(result);
    }

    public Iterable<DecisionResult> results(DecisionResult... result) {
        return Arrays.asList(result);
    }

    public Iterable<DecisionResult> refuse() {
        DecisionResult result = new DecisionResult();
        result.kind = DecisionResult.ResultKind.REFUSE;
        return single(result);
    }
}
